from flask import Flask
import json
from db.dbUtils import MysqlPool
from controller.course_controller import course
from controller.call_controller import call_
from controller.statistics_controller import statistics
from controller.see_controller import see
from flask_cors import *

app = Flask(__name__)
app.register_blueprint(course)
app.register_blueprint(call_)
app.register_blueprint(statistics)
app.register_blueprint(see)
CORS(app, supports_credentials=True)


@app.route('/')
def hello_world():
    with MysqlPool() as pool:
        r = pool.cursor.execute("select * from se_user")
        r = pool.cursor.fetchall()
        print(r)
        return json.dumps(r)
    # return 'Hello World!'


if __name__ == '__main__':
    app.run(debug=True)
